package com.interceptor.interceptordemo.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author sw
 * @project interceptordemo
 * @description
 * @date 2020/5/8 19:47
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private CusHttpInterceptor cusHttpInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(cusHttpInterceptor).addPathPatterns("/**","/").excludePathPatterns("/toLogin","/login");
    }
}
